if (WIN32)
	if(MSVC)
		add_definitions(  -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
	else(MSVC)
        add_definitions(-DBOOST_ALL_NO_LIB)
		add_definitions( -DBOOST_ASIO_DISABLE_IOCP -D__USE_W32_SOCKETS )
	endif(MSVC)
else (WIN32)
endif (WIN32)




FILE(GLOB _H "*.h")
if(UNIT_TEST)
set (_CPP server.cpp network.cpp user.cpp userMgr.cpp serverConn.cpp)
else(UNIT_TEST)
FILE(GLOB _CPP "*.cpp")
endif(UNIT_TEST)


add_library (network STATIC ${_H} ${_CPP})
if(MSVC)
else(MSVC)
target_link_libraries( network pthread)
endif(MSVC)

SET_TARGET_PROPERTIES( network PROPERTIES RELEASE_OUTPUT_NAME "network")
if (MSVC)
SET_TARGET_PROPERTIES( network PROPERTIES DEBUG_OUTPUT_NAME "network_d")
else(MSVC)
SET_TARGET_PROPERTIES( network PROPERTIES DEBUG_OUTPUT_NAME "network_d")
endif(MSVC)

if(ANDROID_NDK)
    #target_link_libraries( network libgnustl_shared.so libcrystax_shared.so )
    #target_link_libraries( network libgnustl_static.a libcrystax_static.a )
else(ANDROID_NDK)
    if(UNIT_TEST)
        #add_executable(server server.cpp network.cpp user.cpp userMgr.cpp serverConn.cpp)
        add_executable(server ${_CPP})
        #add_executable(client client.cpp network.cpp)
        if(MSVC)
        else(MSVC)
            #target_link_libraries( client pthread)
        target_link_libraries( server pthread )
        endif(MSVC)
    endif(UNIT_TEST)
endif(ANDROID_NDK)


#SET_RUNTIME_LINK(STATIC)
